package com.pdstudio.weather;

import java.util.Arrays;

import com.pdstudio.wheel.ArrayWheelAdapter;
import com.pdstudio.wheel.WheelView;
import com.pdstudio.wheel.WheelView1;
import com.pdstudio.wheel.WheelView2;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;

public class Home1Activity extends Activity {

	private final String[] weeks = new String[] { "星期一", "星期二", "星期三", "星期四",
			"星期五", "星期六", "星期天" };

	private WheelView1 wv1;
	private WheelView wv;
	private WheelView2 wv2;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_home1);

		// initWheel1();
		// initWheel();
		initWheel2();
	}

	private void initWheel1() {
		wv1 = (WheelView1) findViewById(R.id.test_wheelview1);
		wv1.setOffset(1);
		wv1.setItems(Arrays.asList(weeks));
		wv1.setOnWheelView1Listener(new WheelView1.OnWheelView1Listener() {
			@Override
			public void onSelected(int selectedIndex, String item) {
				new AlertDialog.Builder(Home1Activity.this).setTitle("标题")
						.setMessage("简单消息框").setPositiveButton("确定", null)
						.show();
			}
		});

	}

	private void initWheel2() {
		wv2 = (WheelView2) findViewById(R.id.test_wheelview2);
		wv2.setOffset(1);
		wv2.setItems(Arrays.asList(weeks));
		wv2.setOnWheelView2Listener(new WheelView2.OnWheelView2Listener() {
			@Override
			public void onSelected(int selectedIndex, String item) {

			}
		});

	}

	private void initWheel() {
		wv = (WheelView) findViewById(R.id.test_wheelview);
		wv.setVisibleItems(3);
		wv.setAdapter(new ArrayWheelAdapter<String>(weeks));
	}
}
